#pragma once

#include "Model.h"


namespace uml {

const QString Model::viewpoint_default_ = "";
Model::Model(const QString& umlType)
    : Package(umlType) {}

void Model::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    Package::fromJson(json, errorList);
    viewpoint_ = json.value("viewpoint").toString(viewpoint_default_);
}

void Model::toJson(QJsonObject& json) {
    Package::toJson(json);
    if (viewpoint_ != viewpoint_default_) {
        json.insert("viewpoint", viewpoint_);
    }
}

/// <summary>
/// viewpoint getter
/// The name of the viewpoint that is expressed by a model (this name may refer to a
/// profile definition).
/// </summary>
QString Model::viewpoint() const {
    return viewpoint_;
}

/// <summary>
/// viewpoint setter
/// The name of the viewpoint that is expressed by a model (this name may refer to a
/// profile definition).
/// </summary>
void Model::setViewpoint(const QString& value) {
    viewpoint_ = value;
}

} // namespace uml
